package guij.controller.subscriber;

import guij.dao.mapper.SubscriberMapper;
import guij.dao.vo.Subscriber;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

//添加一个要订阅的 mail
public class AddMailSub implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		String nick = arg0.getParameter("nick");
		String mail = arg0.getParameter("mail");
		String cycle = arg0.getParameter("cycle");

		Subscriber subscriber = new Subscriber();
		subscriber.setCycle(cycle);
		subscriber.setMail(mail);
		subscriber.setShopNikc(nick);
		subscriber.setAuthed(0);
		subscriber.setHostkey("1");
		subscriber.setClientkey("1");
		subscriberMapper.add(subscriber);
		//TODO send a auth mail
		
		return new ModelAndView();
	}
	private String ViewPage;
	public String getViewPage() {
		return ViewPage;
	}

	public void setViewPage(String viewPage) {
		ViewPage = viewPage;
	}

	SubscriberMapper subscriberMapper;

	public SubscriberMapper getSubscriberMapper() {
		return subscriberMapper;
	}

	public void setSubscriberMapper(SubscriberMapper subscriberMapper) {
		this.subscriberMapper = subscriberMapper;
	}

}
